export default {
    //设置侧边栏选中状态
    setSideRouter(state, routerName) {
        state.sideRouter = routerName;
    },

    //初始化courseData数据
    setCourseData(state, data) {
        state.courseData = data;
    },

    //设置user信息
    setUserData(state, data) {
        state.userData.name = data.username;
    },

    //设置是否选择课程
    setCourseSelectType(state, data) {
        for (let i = 0; i < state.courseData.length; i ++) {
            if (state.courseData[i].id === data.id) {
                state.courseData[i].isSelected = 1;
                state.courseData[i].quantity += 1;
            }
        }
    },

    //设置tab组件index
    setTabIndex(state, data) {
        state.tabIndex = data
    }
}